define(function(require,exports,module){
    var Base={
		mBaserSvrUrl:window.BaseServerUrl,
		localStorage:window.localStorage
	};
	
	function JlnRequest(){
		this.params={}
	}
	module.exports=ConsultProxy;
function ConsultProxy(){
	function consultSubmit(request, success, ignoreError) {
	    var url = Base.mBaserSvrUrl+'/consult';
        if (request.svr == null) request.svr = undefined;
	    if (request.token == null) request.token = undefined;
	    var content = JSON.stringify(request);
       
	    url = url + '?f=t&data=' + encodeURIComponent(content);
	    url = url + '&CallBack=?';
        $.getJSON(url,success);

	}

	function submitLeaveMessageForSystemRq(union,userToken,phoneNum,email,title,content,leaveMessageType,replyType,success,ignoreError){
        var request=new JlnRequest();
        request.func='submitLeaveMessageForSystem';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['pn']=phoneNum;
		request.params['e']=email;
		request.params['t']=title;
		request.params['c']=content;
		request.params['lmt']=leaveMessageType;
		request.params['rt']=replyType;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.submitLeaveMessageForSystemRequest=function(userToken,phoneNum,email,title,content,leaveMessageType,replyType,success,ignoreError){
       var request= submitLeaveMessageForSystemRq(true,userToken,phoneNum,email,title,content,leaveMessageType,replyType,success,ignoreError);
       return request;
    }
	this.submitLeaveMessageForSystem=function(userToken,phoneNum,email,title,content,leaveMessageType,replyType,success,ignoreError){
       var request= submitLeaveMessageForSystemRq(false,userToken,phoneNum,email,title,content,leaveMessageType,replyType,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getLeaveMessageForSystemListRq(union,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
        var request=new JlnRequest();
        request.func='getLeaveMessageForSystemList';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmt']=leaveMessageType;
		request.params['rt']=replyType;
		request.params['rs']=replyStatus;
		request.params['p']=page;
		request.params['cpp']=countPerPage;
		request.params['st']=startTime;
		request.params['et']=endTime;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getLeaveMessageForSystemListRequest=function(leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForSystemListRq(true,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       return request;
    }
	this.getLeaveMessageForSystemList=function(leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForSystemListRq(false,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getLeaveMessageForSystemListByUserRq(union,userToken,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
        var request=new JlnRequest();
        request.func='getLeaveMessageForSystemListByUser';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['lmt']=leaveMessageType;
		request.params['rt']=replyType;
		request.params['rs']=replyStatus;
		request.params['p']=page;
		request.params['cpp']=countPerPage;
		request.params['st']=startTime;
		request.params['et']=endTime;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getLeaveMessageForSystemListByUserRequest=function(userToken,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForSystemListByUserRq(true,userToken,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       return request;
    }
	this.getLeaveMessageForSystemListByUser=function(userToken,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForSystemListByUserRq(false,userToken,leaveMessageType,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getReplyLeaveMessageForSystemRq(union,leaveMessageId,success,ignoreError){
        var request=new JlnRequest();
        request.func='getReplyLeaveMessageForSystem';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmid']=leaveMessageId;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getReplyLeaveMessageForSystemRequest=function(leaveMessageId,success,ignoreError){
       var request= getReplyLeaveMessageForSystemRq(true,leaveMessageId,success,ignoreError);
       return request;
    }
	this.getReplyLeaveMessageForSystem=function(leaveMessageId,success,ignoreError){
       var request= getReplyLeaveMessageForSystemRq(false,leaveMessageId,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function replyLeaveMessageForSystemRq(union,leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError){
        var request=new JlnRequest();
        request.func='replyLeaveMessageForSystem';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmid']=leaveMessageId;
		request.params['userToken']=userToken;
		request.params['rc']=replyContent;
		request.params['rr']=replyResult;
		request.params['r']=remark;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.replyLeaveMessageForSystemRequest=function(leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError){
       var request= replyLeaveMessageForSystemRq(true,leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError);
       return request;
    }
	this.replyLeaveMessageForSystem=function(leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError){
       var request= replyLeaveMessageForSystemRq(false,leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function seeLeaveMessageForSystemRq(union,leaveMessageId,success,ignoreError){
        var request=new JlnRequest();
        request.func='seeLeaveMessageForSystem';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmid']=leaveMessageId;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.seeLeaveMessageForSystemRequest=function(leaveMessageId,success,ignoreError){
       var request= seeLeaveMessageForSystemRq(true,leaveMessageId,success,ignoreError);
       return request;
    }
	this.seeLeaveMessageForSystem=function(leaveMessageId,success,ignoreError){
       var request= seeLeaveMessageForSystemRq(false,leaveMessageId,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function submitLeaveMessageForProductRq(union,userTokenForConsult,userName,productId,phoneNum,email,title,content,replyType,ipAddress,success,ignoreError){
        var request=new JlnRequest();
        request.func='submitLeaveMessageForProduct';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['utfc']=userTokenForConsult;
		request.params['un']=userName;
		request.params['pid']=productId;
		request.params['pn']=phoneNum;
		request.params['e']=email;
		request.params['t']=title;
		request.params['c']=content;
		request.params['rt']=replyType;
		request.params['ia']=ipAddress;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.submitLeaveMessageForProductRequest=function(userTokenForConsult,userName,productId,phoneNum,email,title,content,replyType,ipAddress,success,ignoreError){
       var request= submitLeaveMessageForProductRq(true,userTokenForConsult,userName,productId,phoneNum,email,title,content,replyType,ipAddress,success,ignoreError);
       return request;
    }
	this.submitLeaveMessageForProduct=function(userTokenForConsult,userName,productId,phoneNum,email,title,content,replyType,ipAddress,success,ignoreError){
       var request= submitLeaveMessageForProductRq(false,userTokenForConsult,userName,productId,phoneNum,email,title,content,replyType,ipAddress,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getLeaveMessageForProductListRq(union,userToken,teamName,teamId,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
        var request=new JlnRequest();
        request.func='getLeaveMessageForProductList';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['tn']=teamName;
		request.params['tid']=teamId;
		request.params['rt']=replyType;
		request.params['rs']=replyStatus;
		request.params['p']=page;
		request.params['cpp']=countPerPage;
		request.params['st']=startTime;
		request.params['et']=endTime;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getLeaveMessageForProductListRequest=function(userToken,teamName,teamId,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForProductListRq(true,userToken,teamName,teamId,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       return request;
    }
	this.getLeaveMessageForProductList=function(userToken,teamName,teamId,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForProductListRq(false,userToken,teamName,teamId,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getLeaveMessageForProductListByUserRq(union,userToken,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
        var request=new JlnRequest();
        request.func='getLeaveMessageForProductListByUser';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['rt']=replyType;
		request.params['rs']=replyStatus;
		request.params['p']=page;
		request.params['cpp']=countPerPage;
		request.params['st']=startTime;
		request.params['et']=endTime;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getLeaveMessageForProductListByUserRequest=function(userToken,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForProductListByUserRq(true,userToken,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       return request;
    }
	this.getLeaveMessageForProductListByUser=function(userToken,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError){
       var request= getLeaveMessageForProductListByUserRq(false,userToken,replyType,replyStatus,page,countPerPage,startTime,endTime,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getReplyLeaveMessageForProductRq(union,leaveMessageId,success,ignoreError){
        var request=new JlnRequest();
        request.func='getReplyLeaveMessageForProduct';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmid']=leaveMessageId;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getReplyLeaveMessageForProductRequest=function(leaveMessageId,success,ignoreError){
       var request= getReplyLeaveMessageForProductRq(true,leaveMessageId,success,ignoreError);
       return request;
    }
	this.getReplyLeaveMessageForProduct=function(leaveMessageId,success,ignoreError){
       var request= getReplyLeaveMessageForProductRq(false,leaveMessageId,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function replyLeaveMessageForProductRq(union,leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError){
        var request=new JlnRequest();
        request.func='replyLeaveMessageForProduct';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmid']=leaveMessageId;
		request.params['userToken']=userToken;
		request.params['rc']=replyContent;
		request.params['rr']=replyResult;
		request.params['r']=remark;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.replyLeaveMessageForProductRequest=function(leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError){
       var request= replyLeaveMessageForProductRq(true,leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError);
       return request;
    }
	this.replyLeaveMessageForProduct=function(leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError){
       var request= replyLeaveMessageForProductRq(false,leaveMessageId,userToken,replyContent,replyResult,remark,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function seeLeaveMessageForProductRq(union,leaveMessageId,success,ignoreError){
        var request=new JlnRequest();
        request.func='seeLeaveMessageForProduct';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['lmid']=leaveMessageId;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.seeLeaveMessageForProductRequest=function(leaveMessageId,success,ignoreError){
       var request= seeLeaveMessageForProductRq(true,leaveMessageId,success,ignoreError);
       return request;
    }
	this.seeLeaveMessageForProduct=function(leaveMessageId,success,ignoreError){
       var request= seeLeaveMessageForProductRq(false,leaveMessageId,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function PostCommentRq(union,userToken,productId,content,isCryptonym,success,ignoreError){
        var request=new JlnRequest();
        request.func='PostComment';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['pid']=productId;
		request.params['c']=content;
		request.params['ic']=isCryptonym;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.PostCommentRequest=function(userToken,productId,content,isCryptonym,success,ignoreError){
       var request= PostCommentRq(true,userToken,productId,content,isCryptonym,success,ignoreError);
       return request;
    }
	this.PostComment=function(userToken,productId,content,isCryptonym,success,ignoreError){
       var request= PostCommentRq(false,userToken,productId,content,isCryptonym,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getCommentListRq(union,productId,order,page,countPerPage,success,ignoreError){
        var request=new JlnRequest();
        request.func='getCommentList';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['pid']=productId;
		request.params['o']=order;
		request.params['p']=page;
		request.params['cpp']=countPerPage;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getCommentListRequest=function(productId,order,page,countPerPage,success,ignoreError){
       var request= getCommentListRq(true,productId,order,page,countPerPage,success,ignoreError);
       return request;
    }
	this.getCommentList=function(productId,order,page,countPerPage,success,ignoreError){
       var request= getCommentListRq(false,productId,order,page,countPerPage,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getMyCommentListRq(union,userToken,page,countPerPage,success,ignoreError){
        var request=new JlnRequest();
        request.func='getMyCommentList';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['p']=page;
		request.params['cpp']=countPerPage;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getMyCommentListRequest=function(userToken,page,countPerPage,success,ignoreError){
       var request= getMyCommentListRq(true,userToken,page,countPerPage,success,ignoreError);
       return request;
    }
	this.getMyCommentList=function(userToken,page,countPerPage,success,ignoreError){
       var request= getMyCommentListRq(false,userToken,page,countPerPage,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function deleteMyCommentRq(union,userToken,commentId,success,ignoreError){
        var request=new JlnRequest();
        request.func='deleteMyComment';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['userToken']=userToken;
		request.params['cid']=commentId;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.deleteMyCommentRequest=function(userToken,commentId,success,ignoreError){
       var request= deleteMyCommentRq(true,userToken,commentId,success,ignoreError);
       return request;
    }
	this.deleteMyComment=function(userToken,commentId,success,ignoreError){
       var request= deleteMyCommentRq(false,userToken,commentId,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getAdvertisementsRq(union,belongs,success,ignoreError){
        var request=new JlnRequest();
        request.func='getAdvertisements';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['b']=belongs;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getAdvertisementsRequest=function(belongs,success,ignoreError){
       var request= getAdvertisementsRq(true,belongs,success,ignoreError);
       return request;
    }
	this.getAdvertisements=function(belongs,success,ignoreError){
       var request= getAdvertisementsRq(false,belongs,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getJournalismtListRq(union,type,page,countPerPage,success,ignoreError){
        var request=new JlnRequest();
        request.func='getJournalismtList';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['t']=type;
		request.params['p']=page;
		request.params['cpp']=countPerPage;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getJournalismtListRequest=function(type,page,countPerPage,success,ignoreError){
       var request= getJournalismtListRq(true,type,page,countPerPage,success,ignoreError);
       return request;
    }
	this.getJournalismtList=function(type,page,countPerPage,success,ignoreError){
       var request= getJournalismtListRq(false,type,page,countPerPage,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getJournalismtByIdRq(union,Id,success,ignoreError){
        var request=new JlnRequest();
        request.func='getJournalismtById';
        request.token = Base.localStorage.getItem('request_token');
		
		request.params['id']=Id;

		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getJournalismtByIdRequest=function(Id,success,ignoreError){
       var request= getJournalismtByIdRq(true,Id,success,ignoreError);
       return request;
    }
	this.getJournalismtById=function(Id,success,ignoreError){
       var request= getJournalismtByIdRq(false,Id,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }

	function getJournalismMaxIdRq(union,success,ignoreError){
        var request=new JlnRequest();
        request.func='getJournalismMaxId';
        request.token = Base.localStorage.getItem('request_token');
		
		if (union == true) {
	        request.svr = 'consult';
            request.ignoreError = ignoreError;
	        request.success = success;
        }
	    return request;
    }
	this.getJournalismMaxIdRequest=function(success,ignoreError){
       var request= getJournalismMaxIdRq(true,success,ignoreError);
       return request;
    }
	this.getJournalismMaxId=function(success,ignoreError){
       var request= getJournalismMaxIdRq(false,success,ignoreError);
       consultSubmit(request, success, ignoreError);

    }
}

});
